package com.boot.controller;

import com.boot.product.pojo.Product;
import com.boot.service.ProductService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("product")
@FeignClient(name = "")
public class ProductController {

    @Autowired
    ProductService productService;

    //查询商品
    @GetMapping("/{id}")
    public Product getProduct(@PathVariable("id") Long productId, HttpServletRequest request) {
        System.out.println("hello");
        System.out.println(request.getHeader("X-Token"));
        return productService.getProductById(productId);
    }
}
